{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit">
    
	<!-- <div class="demoTable layui-row">
		<button class="layui-btn" style="margin-left:30px;margin-top:15px;" id="search" data-type="reload">{:lang('search')}</button>
		<a href="{:url('index')}" style="margin-top:15px;" class="layui-btn">{:lang('reset')}</a>
		
	</div> -->
	<!-- 这个是列表  -->
    <table class="layui-table" id="list" lay-filter="list"></table>

</div>

{include file="common/foot"/}

<script type="text/html" id="action">
    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">{:lang('edit')}</a>
</script>
<script type="text/html" id="logo">
    <img src="{{d.logo}}" alt="" style="width:80%;height:100%;">
</script>
<script>
	layui.use('laydate', function(){
		var laydate = layui.laydate;
		//日期时间范围
		laydate.render({
			elem: '#test10'
			,type: 'datetime'
			,range: true
		});
	})
	// 表格js部分
    layui.use(['table','form'], function() {
        var table = layui.table,form = layui.form,$ = layui.jquery;
        var tableIn = table.render({
			id: 'ad',
            elem: '#list',
            url: '{:url("message")}',
            method:'post',   
			page:true,	
            cols: [[ 
				{field: 'id',align: 'center', title: '{:lang("id")}', width: 80, fixed: true, sort: true},
                {field:'title',align:'center', title: '名称', width:200,fixed: true},
				{field:'content',align:'center', title: '内容', width:600,fixed: true},
                {width: 160, align: 'center',title: '{:lang("action")}', toolbar: '#action'}
            ]],
            limit:''
        });
       		form.on('switch(open)', function(obj){
            loading =layer.load(1, {shade: [0.1,'#fff']});
            var id = this.value;
            var is_open = obj.elem.checked===true?1:0;
        });
		//点击table上的按钮
        table.on('tool(list)', function(obj){
            //获取当前点击行的数据
            var data = obj.data;
            console.log(data)

            if(obj.event === 'edit'){
                location.href = `/admin/template/messageedit.html?id=${data.id}`

            }
        });

    });
</script>
</body>
</html>